﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;
using eShop.Model;
using eShop.Business;

public partial class admin_shipping_rate_list : SiteAdminBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)
    {
        BindRates(String.IsNullOrEmpty(e.Sort) ? "Id" : e.Sort + (e.Dir.ToString() == "Default" ? "" : " " + e.Dir), e.Start, e.Limit);
    }

    private void BindRates(string sort, int start, int limit)
    {
        List<ShippingRate> pagedCustomer = null;
        int totalCount = 0;
        start = start + 1;
        bool isAsc = sort.Contains("asc") ? true : false;

        pagedCustomer = ShippingRateManager.GetShippingRatesPaged(sort, isAsc, start, limit);
        totalCount = 10; //ShippingRateManager.GetShippingRatesPagedCount();
        Store1.DataSource = pagedCustomer;
        Store1.DataBind();

        (Store1.Proxy[0] as PageProxy).Total = totalCount;
    }

}